let path = require('path')
let { CleanWebpackPlugin } = require('clean-webpack-plugin')
let html = require('html-webpack-plugin')
let webpack = require('webpack')
module.exports = {
  mode: "production",
  entry: './src/index.js',
  output: {
    filename: 'index.[fullhash:6].js',
    path: path.resolve(__dirname, 'mydist')
  },
  plugins: [
    new CleanWebpackPlugin({
      cleanOnceBeforeBuildPatterns: ['**/*', '!qq.html']
    }),
    new html({
      template: './public/index.html',//  指定用来渲染的html模板
      // filename: 'main.html',// 生成的html文件的名字
      title123: "珠峰888",
      qqq: '<link href="https://baidu.com/1.css"/>'
    }),
    new webpack.DefinePlugin({
      //  提供编译阶段的全局常量
      PRODUCTION: JSON.stringify(true),
      VERSION: JSON.stringify('5fa3b9'),
      BROWSER_SUPPORTS_HTML5: true,
      TWO: '1+1',
      'typeof window': "'object123'"
    })
  ]
}